package com.hskn.hss.module.alarmHandleLog.controller;

import com.hskn.hss.core.controller.BaseController;
import com.hskn.hss.core.domain.AjaxResult;
import com.hskn.hss.core.page.TableDataInfo;
import com.hskn.hss.core.utils.poi.ExcelUtil;
import com.hskn.hss.module.alarmHandleLog.domain.AlarmHandleLog;
import com.hskn.hss.module.alarmHandleLog.service.IAlarmHandleLogService;
import com.hskn.hss.module.alarmHandleLog.to.AlarmHandleLogListTO;
import com.hskn.hss.module.alarmHandleLog.vo.AlarmHandleLogVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 报警处理记录Controller
 * 
 * @author ccm
 * @date 2021-09-07
 */
@Api(tags = {"-alarm_handle_log"}, description = "报警处理记录")
@RestController
@RequestMapping("/hss/alarmHandleLog")
public class AlarmHandleLogController extends BaseController
{
    @Autowired
    private IAlarmHandleLogService alarmHandleLogService;

    /**
     * 查询报警处理记录列表
     */
    @ApiOperation(value = "查询报警处理记录列表", notes = "查询报警处理记录列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok",response = AlarmHandleLogVO.class)
    })
    @PostMapping("/selectAlarmHandleLogListByAlarmId")
    public com.hskn.hss.entity.AjaxResult selectAlarmHandleLogListByAlarmId(@RequestBody @Validated AlarmHandleLogListTO alarmHandleLogListTO)
    {
        List<AlarmHandleLogVO> list = alarmHandleLogService.selectAlarmHandleLogListByAlarmId(alarmHandleLogListTO);
        return com.hskn.hss.entity.AjaxResult.success(list);
    }

    /**
     * 导出报警处理记录列表
     */
    @GetMapping("/export")
    public AjaxResult export(AlarmHandleLog alarmHandleLog)
    {
        List<AlarmHandleLog> list = alarmHandleLogService.selectAlarmHandleLogList(alarmHandleLog);
        ExcelUtil<AlarmHandleLog> util = new ExcelUtil<AlarmHandleLog>(AlarmHandleLog.class);
        return util.exportExcel(list, "报警处理记录数据");
    }

    /**
     * 获取报警处理记录详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(alarmHandleLogService.selectAlarmHandleLogById(id));
    }


}
